<?php
/*
**************************************************************************
*  File: ADMIN DIR/templates/default/index.php
*  (c) Extreme Portal Light Version 2012-2014
*  By elwizard. All rights reserved.
*  http://www.mgsteam.es
*
*  This program is free software under MGS License Agreement. 
*  You cannot distribute in any way. For modifications, please read 
*  MGS License Agreement for more information.
*
**************************************************************************
*/

class admin_template {

function header_admin($stylesheet, $AJAX) {
global $ext, $global;
 
return <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Elwizard &amp; MGS Team web oficial - (c) 2012-2014 por Elwizard</title>
<meta name="description" content="Herramientas para usuarios en PHP y MySQL. Esta es una web de dise??e PHP y MYSQL, que proporciona herramientas para webmasters." />
<meta name="keywords" content="elwizard, MGS Team, tools, MGS, php, mysql, html, css, xhtml, cms" />
<meta http-equiv="title" content="MGS Team official website" />
<meta name="author" content="MGS Team - elwizard" />
<meta content="Copyright (c) por Magic Games Software - elwizard" name="copyright" />
<meta name="vw96.objectype" content="Document" />
<meta name="resource-type" content="Document" />
<meta name="distribution" content="all" />
<meta name="robots" content="all" />
<meta name="language" content="sp" />
<meta name="revisit" content="10 days" /> 
<meta content="general" name="rating" />
<meta content="global" name="distribution" />
<meta content="Extreme Portal 1.0" name="generator" />
$stylesheet

<link rel="stylesheet" href="{$global['website']}/{$global['ext_admin_dir']}/templates/default/sunny/jquery.ui.all.css">
	
<link href="{$global['website']}favicon.ico" rel="SHORTCUT ICON" />
$AJAX

<script src="../include/jquery.js" type="text/javascript"></script>
<script src="../include/jquery.ui.core.js" type="text/javascript"></script>
<script src="../include/jquery.ui.widget.js" type="text/javascript"></script>
<script src="../include/jquery.ui.mouse.js" type="text/javascript"></script>
<script src="../include/jquery.ui.sortable.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://jqueryui.com/demos/demos.css">

<script src="../include/include/jquery.magnifier.js" type="text/javascript">
/***********************************************
* jQuery Image Magnify- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/

</script>

<script type="text/javaScript">
<!--

//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
// --> 

/* crea una cookie */
function createCookie1(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function toggle_visibility(id, id1) {

       var e = document.getElementById(id);
       var f = document.getElementById(id1);
       if(e.style.display == 'block') {
          e.style.display = 'none';
          f.src = "templates/default/images/plus-sign.png";
          createCookie1('ADM{$global['website_cookie']}_'+id,'display:none',365);
       } else {
          e.style.display = 'block';
          f.src = "templates/default/images/minus-sign.png";
          createCookie1('ADM{$global['website_cookie']}_'+id,'display:block',365);
       }
}

</script>

<script type="text/javascript">

$(document).ready(function() {

	$(function() {
		
		$( ".column" ).sortable({
			connectWith: ".column"
		});		
		
		$(".column").sortable({
      update : function () {
	    
	    // columna izq
		  var datos1 = "";
		  var nrdivs1 = document.getElementById('coll').getElementsByTagName('div');
		  for (var no=0; no<nrdivs1.length; no++) {
			  datos1 = datos1 + nrdivs1[no].id+";";
			}
			
			// columna central
		  var datos2 = "";
		  var nrdivs2 = document.getElementById('colc').getElementsByTagName('div');
		  for (var no=0; no<nrdivs2.length; no++) {	
			  datos2 = datos2 + nrdivs2[no].id + ";";
			}
			
			// columna der
		  var datos3 = "";
		  var nrdivs3 = document.getElementById('colr').getElementsByTagName('div');
		  for (var no=0; no<nrdivs3.length; no++) {
			  datos3 = datos3 + nrdivs3[no].id + ";";
			}
		  
		  $("#info").load("adm_escribe_ajax.php?col1="+datos1+"&col2="+datos2+"&col3="+datos3);
  		
      }
    });
    

		$(".portlet").addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
			.find( ".portlet-header" )
		  .addClass( "ui-widget-header ui-corner-all" )
		  .prepend( "<span class='ui-icon ui-icon-minusthick'></span>")
			.end()
			.find( ".portlet-content" );

		$( ".portlet-header .ui-icon" ).click(function() {
			$( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" );
			$( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
		});

		$(".column").disableSelection();
	});
	
});	
	</script>

<style>
#info {
	display: block;
	width: 400px;
	padding: 10px; margin-bottom: 20px;
	border: 1px solid #333;
	font-size: 12px;
	background-color: #efefef;
}

.colheader { margin 0px; padding: 5px; font-size: 14px; border-collapse: collapse; font-weight: bold; width: 190px; border: 1px dotted grey; vertical-align: top; text-align: center}
.column { width: 190px; border: 0px; margin: 0px; padding: 0px; border-collapse: collapse; height: 100%; padding-bottom: 100px; font-size: 10px; font-weight: normal; text-align: center;}
.column2 { width: 20px; padding-bottom: 100px;}
.portlet { margin: 0 0 1em 0; }
.portlet-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; }
.portlet-header .ui-icon { float: right; }
.portlet-content { padding: 0.4em; }
.portlet-content1 { padding: 0.4em; background-color: #ffd7e3;}
.ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 50px !important; }
.ui-sortable-placeholder * { visibility: hidden; }
</style>

</head>
<body class="background" dir="{$ext->config['portal_direction']}">
EOF;
}

function open_main_admin() {
global $ext;

return <<<EOF
<table style="border: 0px; width: 100%; margin: 0px; padding-top: 0px; background: #f0f0f0; border-collapse: collapse;">
<tr>
<td align="center">
<div style="width: 900px; border-collapse:collapse;">
<div class="wrapper">

<table class="tabmain">

  <tr>
    <td class="gborder_left">&nbsp;</td>   
    <td style="width: 878px;" align="center" valign="top">
      <table width="100%" cellpadding="0" cellspacing="0" style="border: 0px; border-collapse:collapse;">
EOF;
}

function view_logo_admin_login() {
global $global;

return <<<EOF
	<tr>
	  <td id="header" align="right">
	  	 
    </td>
  </tr>
EOF;
}

function view_logo_admin() {
global $global, $vbulletin;

return <<<EOF
	<tr>
	  <td id="header" style="text-align: right">
	  	<div style="float: left"><img src="{$global['website']}/{$global['ext_admin_dir']}/templates/default/images/admin_logo.png" alt="" /></div>
	  	 Bienvenido al panel de administración <b>{$vbulletin->userinfo['username']}</b> | 
	  	 <a href="{$global['website']}/index.php" style="font-weight: bold;">Ir a la web</a> |
	  	 <a href="{$vbulletin->options['bburl']}/login.php?do=logout&amp;logouthash={$vbulletin->userinfo['logouthash']}" style="font-weight: bold;">Salir sesión</a><br /><br />
    </td>
  </tr>
EOF;
}

function open_body_admin() {
  global $ext;
  
return <<<EOF
  <tr class="content">
    <td align="center">
      
    </td>
	</tr>
	
	<tr align="center" class="content">
	  <td>

EOF;
}

function close_body_admin() {
  global $global;
return <<<EOF

	  </td>
	</tr>
	
	<tr>
	  <td id="footer">
	  	 <span style="color: black;">
            <!-- WARNING: YOU ARE NOT ALLOWED TO MODIFY OR DELETE THIS CREDITS IN ANY WAY. YOUR LICENSE WILL BE BROKEN AND YOU WILL LOSE ALL RIGHTS. -->
            <!-- ATENCI?: NO TIENES PERMISO PARA MODIFICAR O BORRAR LOS SIGUIENTES CR?ITOS DE NINGUNA MANERA. PERDER TU LICENCIA Y TODOS TUS DERECHOS SI LO HACES. -->
            &copy; 2010-2012 <a href="http://www.elwizard.es" title="MGS Team Homepage">Extreme Portal</a> Light Version v. 0.1 ALFA 1 + vBulletin integration by elwizard - MGS Team.<br />
            <br />
            <img src="{$global['website']}/images/logo.jpg" alt="" style="border: 0px;" />
            <!-- END WARNING -->
            <br /><br />
        </span>
    </td>
  </tr>
EOF;
}

function close_main_admin() {

return <<<EOF
	
      </table>
    </td>
    <td class="gborder_right">&nbsp;</td>  
    
  </tr>

</table>
<!-- GRAFICOS BOTTOM -->
<table style="width: 900px; border-collapse: collapse; margin: 0px; padding: 0px; border: 0px;">
	<tr>
		<td class="gborder_bottom_left"></td>
		<td class="gborder_bottom_center"></td>
		<td class="gborder_bottom_right"></td>
  </tr>
</table>
	



</div>
</div>
</td>
</tr>
</table>
EOF;
}

function footer_admin() {
global $ext, $DB;

return <<<EOF
</body></html>
EOF;
}

################################################### BLOCKS AND MODULES ################################



function view_column_left($blocks) {
global $ext;
return <<<EOF
    <div id="left_col">
		<td valign="top" style="width: 181px; text-align: right; padding-left: 5px">
		  <table width="100%" cellpadding="0" cellspacing="0" border="0">
		  
		  {$blocks}
		  
		  </table>
		</td>
		</div>
  
EOF;
}


function view_column_right($blocks) {
global $ext;
return <<<EOF
    <div id="right_col">
		<td valign="top" style="width: 181px; text-align: right; padding-left: 15px">
		  <table width="100%" cellpadding="0" cellspacing="0" border="0">
		  
		  {$blocks}
		  
		  </table>
		</td>
    </div>
EOF;
}


function view_column_center($blocks) {
global $ext;

return <<<EOF
		<td valign="top" style="padding-left: 5px">
		  <table width="100%" cellpadding="1" cellspacing="1" border="0">

           {$blocks}

		  </table>
		</td>
EOF;
}




function view_block($title, $content, $id, $display='block') {
global $global;

$mycookie = 'ADM'.$global['website_cookie'].'_extblock'.$id;
if (isset($_COOKIE[$mycookie])) {
  $thisstyleblock = $_COOKIE[$mycookie];
  
  if ($thisstyleblock=="display:block")
	    $iconplace = "minus-sign.png";
	  else
	    $iconplace = "plus-sign.png";
  
} else {
	if ($display!="") {
	  $thisstyleblock = "display:{$display}";
	  if ($display=="block")
	    $iconplace = "minus-sign.png";
	  else
	    $iconplace = "plus-sign.png";
  } else {
    $thisstyleblock = "display:block";
    $iconplace = "plus-sign.png";
  }
}

return <<<EOF
		    <tr>
		      <td valign="top" style="width: 181px">
		      	
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse">
	<tr>
     <td class="blocktitle">
			  <div style="background: transparent; float: left; padding-left: 15px">
		      {$title}
		    </div>
		    <div style="background: transparent; float: right; padding-right: 5px">
		      <img id="exta{$id}" onclick="toggle_visibility('extblock{$id}', 'exta{$id}'); return false;" src="templates/default/images/{$iconplace}" />
		    </div>
		 </td>
  </tr>
 
  <tr>
    <td class="tdblock" colspan="2">
		  
		  <div id="extblock{$id}" style="{$thisstyleblock}">
		  <table border="0" width="100%" cellpadding="0" cellspacing="0">
		    {$content}
      </table>
      </div>
      
    </td>
 </tr>
 
 <tr>
     <td class="blockbottom">
		 </td>
 </tr>
 
 </table>
 </td>
 </tr>
	
	<tr>
	  <td class="tdspacer">&nbsp;
		</td>
	</tr>
	
EOF;

}

function view_module($title, $content, $id) {
global $global;
	
$mycookie = 'ADM'.$global['website_cookie'].'_extblock'.$id;
if (isset($_COOKIE[$mycookie])) {
  $thisstyleblock = $_COOKIE[$mycookie];
  
  if ($thisstyleblock=="display:block")
	    $iconplace = "minus-sign.png";
	  else
	    $iconplace = "plus-sign.png";
  
} else {
	if ($display!="") {
	  $thisstyleblock = "display:{$display}";
	  if ($display=="block")
	    $iconplace = "minus-sign.png";
	  else
	    $iconplace = "plus-sign.png";
  } else {
    $thisstyleblock = "display:block";
    $iconplace = "plus-sign.png";
  }
}

return <<<EOF
		    <tr>
		      <td valign="top" style="width: 655px">
		      	
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="655px">
	<tr>
     <td class="moduletitle">
       
       <table cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: 100%; border: 0px; ">
       <tr>
         <td style="color: #800000; font-weight: bolder; font-size: 15px; text-align: center">
           {$title}
         </td>
         <td style="width:5%; padding-right: 10px">
           <img id="exta{$id}" onclick="toggle_visibility('extblock{$id}', 'exta{$id}'); return false;" src="templates/default/images/{$iconplace}" style=" float: right; padding-right: 10px" />
         </td>
       </tr>
       </table>
		 </td>
  </tr>
  <tr>
    <td class="tdmodule">
		  
		  <div id="extblock{$id}" style="{$thisstyleblock}">
		  <table border="0" width="100%" cellpadding="0" cellspacing="0">
		    {$content}
      </table>
      </div>
    
    </td>
 </tr>
 
 <tr>
     <td class="modulebottom">
		 </td>
 </tr>
 
 </table>
 </td>
 </tr>
	
	<tr>
	  <td class="tdspacer">&nbsp;
		</td>
	</tr>
	
EOF;
}

function view_module_empty($title, $content) {

return <<<EOF
		    <tr>
		      <td valign="top" style="width: 100%">
		      	
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse">
	<tr>
     <td>
			 $title   
		 </td>
  </tr>
  <tr>
    <td>
		
		  <table border="0" width="100%" cellpadding="0" cellspacing="0">
		    {$content}
      </table>
    
    </td>
 </tr>
 
 </table>
 </td>
 </tr>
	
	<tr>
	  <td class="tdspacer">&nbsp;
		</td>
	</tr>
	
EOF;
}

function get_contents($title, $title2, $content1) {

return <<<EOF
		    <tr>
		      <td valign="top" style="width: 800px" class="bmodulecontent">
		      	
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="800px">
	<tr>
     <td class="moduleheader">
			 $title
		 </td>
  </tr>
  <tr>
    <td class="modulecontent">
		
		  <table border="0" width="100%" cellpadding="0" cellspacing="4">
		    {$content1}
      </table>
    
    </td>
 </tr>
 
 <tr>
     <td class="modulebottom1">
		 </td>
 </tr>
 
 </table>
 </td>
 </tr>	
EOF;
}

function contents_login($title, $title2, $content1) {

return <<<EOF
		    <tr>
		      <td valign="top" style="width: 800px; text-align: center" class="bmodulecontent bmodulecontent_login">
		      	
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;" width="450px">
	<tr>
     <td class="mheader_login">
			 $title
		 </td>
  </tr>
  <tr>
    <td class="mcontent_login">
		
		  <table border="0" width="100%" cellpadding="0" cellspacing="4">
		    {$content1}
      </table>
    
    </td>
 </tr>
 
 <tr>
     <td class="mbottom_login">
		 </td>
 </tr>
 
 </table>
 </td>
 </tr>	
EOF;
}



} // end class

$tpl = new admin_template;

?>